<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../aaa/css/font.css">
    <link rel="stylesheet" href="../aaa/css/xadmin.css">
    <script type="text/javascript" src="../aaa/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../aaa/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
                <div class="layui-form-item">
                    <label  class="layui-form-label">分销需求id:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="dis_need_id" name="dis_need_id" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${dis_need.dis_need_id}">
                    </div>
                    <label class="layui-form-label">分销商:</label>
                    <div class="layui-input-inline">
                        <select name="distributorid" id="distributorid">
                            <option th:each="distributors:${distributors}"
                                    th:value="${distributors.distributorid}"
                                    th:selected="${dis_need.distributorid eq distributors.distributorid}"
                                    th:text="${distributors.distributorname}"
                            ></option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品供应商:</label>
                    <div class="layui-input-inline">
                        <select name="supId" id="supId">
                            <option th:each="suppliers:${suppliers}"
                                    th:value="${suppliers.supId}"
                                    th:selected="${dis_need.supId eq suppliers.supId}"
                                    th:text="${suppliers.supName}"
                            ></option>
                        </select>
                    </div>
                    <label class="layui-form-label">商品详情:</label>
                    <div class="layui-input-inline">
                        <select name="commodityid" id="commodityid">
                            <option th:each="commodities:${commodities}"
                                    th:value="${commodities.commodityid}"
                                    th:selected="${dis_need.commodityid eq commodities.commodityid}"
                                    th:text="${commodities.commodityname}"
                            ></option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">包装类型:</label>
                    <div class="layui-input-inline">
                        <select name="Bcategoryid" id="Bcategoryid">
                            <option th:each="Bcategory:${bcategory}"
                                    th:value="${Bcategory.Bcategoryid}"
                                    th:selected="${dis_need.Bcategoryid eq Bcategory.Bcategoryid}"
                                    th:text="${Bcategory.Bcategoryname}"
                            ></option>
                        </select>
                    </div>
                    <label class="layui-form-label">包装供应商:</label>
                    <div class="layui-input-inline">
                        <select name="BsupId" id="BsupId">
                            <option th:each="bsuppliers:${bsuppliers}"
                                    th:value="${bsuppliers.BsupId}"
                                    th:selected="${dis_need.BsupId eq bsuppliers.BsupId}"
                                    th:text="${bsuppliers.BsupName}"
                            ></option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">物流公司:</label>
                    <div class="layui-input-inline">
                        <select name="logId" id="logId">
                            <option th:each="logistics:${logistics}"
                                    th:value="${logistics.logId}"
                                    th:selected="${dis_need.logId eq logistics.logId}"
                                    th:text="${logistics.logname}"
                            ></option>
                        </select>
                    </div>
                    <label class="layui-form-label">运输方式:</label>
                    <div class="layui-input-inline">
                        <select name="logmodeid" id="logmodeid">
                            <option th:each="logmodes:${logmodes}"
                                    th:value="${logmodes.logmodeid}"
                                    th:selected="${dis_need.logmodeid eq logmodes.logmodeid}"
                                    th:text="${logmodes.logmodename}"
                            ></option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item" >
                    <label class="layui-form-label">审核类型:</label>
                    <div class="layui-input-inline">
                        <select name="statusid" id="status1">
                            <option th:each="status1:${status1s}"
                                    th:value="${status1.statusid}"
                                    th:selected="${dis_need.statusid eq status1.statusid}"
                                    th:text="${status1.statusname}"
                            ></option>
                        </select>
                    </div>
                    <label  class="layui-form-label">定金:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="advance" name="advance" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${dis_need.advance}">
                    </div>
                </div>
                <div class="layui-form-item" >
                    <label  class="layui-form-label">商品数量:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="Samnumber" name="Samnumber" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${dis_need.Samnumber}">
                    </div>
                    <label  class="layui-form-label">定金:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="birth" name="birth" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${dis_need.birth}">
                    </div>
                </div>
                <div class="layui-form-item" >
                    <label  class="layui-form-label">包装数量:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="satypenumber" name="satypenumber" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${dis_need.satypenumber}">
                    </div>
                    <label class="layui-form-label">包装名:</label>
                    <div class="layui-input-inline">
                        <select name="needId" id="needId">
                            <option th:each="need:${needs}"
                                    th:value="${need.needId}"
                                    th:selected="${need.needId eq dis_need.needId}"
                                    th:text="${need.needName}"
                            ></option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item" >
                    <label  class="layui-form-label">物流单号:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="logparticularsid" name="logparticularsid" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${dis_need.logparticularsid}">
                    </div>
                </div>
            <div class="layui-form-item">
                <center>
                    <button  class="layui-btn" lay-filter="add" lay-submit="">
                        修改
                    </button>
                </center>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['form', 'layer','jquery'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            //监听提交
            form.on('submit(add)',
                function(data) {
                    console.log(data.field);
                    var datas=data.field;
                    if (datas.status=="on"){
                        datas.status=0;//正常状态
                    }else {
                        datas.status=1;
                    }

                    $.ajax({
                        url: "/dis_need/Dis_needUpd",
                        type: "POST",
                        data:datas,
                        success: function (result) {

                            if (result.code==200){
                                layer.msg("修改失败");
                            }
                            else {
                                layer.msg("修改成功",{
                                    icon: 6,
                                    time:500
                                },function() {
                                    parent.window.location.reload();//重新页面
                                    // 获得frame索引
                                    var index = parent.layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    parent.layer.close(index);
                                });
                            }
                        }
                        , error:function (e) {
                            //返回500错误 或者其他 http状态码错误时 需要在error 回调函数中处理了 并且返回的数据还不能直接alert，需要使用
                            //$.parseJSON 进行转译    res.msg 是自己组装的错误信息通用变量
                            var res = $.parseJSON(e.responseText);
                            layer.msg("修改失败,检查数据填输是否完整,正确");
                        }
                    });
                    return false;
                });


        });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>
